package com.bumblebee.server.model;

import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;

/**
 * 
 * @author Dinesh
 * Represents a product in the store. A product can belong to any number of categories.
 */
@Entity
public class Product extends AbstractEntity{

	public Product(String name, String printName) {
		super();
		this.name = name;
		this.printName = printName;
	}

	protected Product(){}
	
	@Column(unique = true,nullable =false)
	private String name;

	@Column(nullable=false)
	private String printName;

	@Column(unique = true,nullable=false)
	private String styleCode;

	private String barCode;

	private Gender gender;

	private Integer shade;

	private String brand;

	private String size;

	private Double price;

	@ManyToMany(cascade = CascadeType.ALL)
	private Set<Category> categories = new HashSet<Category>(0);

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPrintName() {
		return printName;
	}

	public void setPrintName(String printName) {
		this.printName = printName;
	}

	public String getStyleCode() {
		return styleCode;
	}

	public void setStyleCode(String styleCode) {
		this.styleCode = styleCode;
	}

	public String getBarCode() {
		return barCode;
	}

	public void setBarCode(String barCode) {
		this.barCode = barCode;
	}

	public Integer getShade() {
		return shade;
	}

	public void setShade(Integer shade) {
		this.shade = shade;
	}

	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}

	public String getSize() {
		return size;
	}

	public void setSize(String size) {
		this.size = size;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Set<Category> getCategories() {
		return categories;
	}

	public void setCategories(Set<Category> categories) {
		this.categories = categories;
	}
	/**
	 * Add this product to the category given
	 * @param category
	 */
	public void addCategory(Category category){
		this.categories.add(category);
	}

	public Gender getGender() {
		return gender;
	}

	public void setGender(Gender gender) {
		this.gender = gender;
	}
}
